﻿Public MustInherit Class EIBBusMessageLogBase

    Protected _timeStamp As DateTime = Nothing
    Public ReadOnly Property Timestamp As DateTime
        Get
            Return _timeStamp
        End Get
    End Property

    Protected _isDublicate As Boolean = False
    Public ReadOnly Property IsDublicate As Boolean
        Get
            Return _isDublicate
        End Get
    End Property

    Protected _message As String
    Public ReadOnly Property Message As String
        Get
            Return _message
        End Get
    End Property

    Protected _busdata As Byte() = Nothing
    Public ReadOnly Property BusData As Byte()
        Get
            Return _busdata
        End Get
    End Property
End Class


Public Class EIBBusMessageLogInfo
    Inherits EIBBusMessageLogBase

    Sub New(message As String)
        _timeStamp = Now
        _isDublicate = False
        _message = message
        _busdata = Nothing
    End Sub

    Sub New(message As String, busdata As Byte())
        _timeStamp = Now
        _isDublicate = False
        _message = message
        _busdata = busdata
    End Sub
End Class


Public Class EIBBusMessageLogEntry
    Inherits EIBBusMessageLogBase

    Sub New(message As String, busdata As Byte(), sourceAddress As EIB.Bus.Addressing.EIBPhysicalAddress, destinationAddress As EIB.Bus.Addressing.EIBAddress, type As EIB.BusData.EIBBusData_FrameACPI_L_Data_Type, value As Byte())
        Me.New(False, message, busdata, sourceAddress, destinationAddress, type, value)
    End Sub

    Sub New(isDublicate As Boolean, message As String, busdata As Byte(), sourceAddress As EIB.Bus.Addressing.EIBPhysicalAddress, destinationAddress As EIB.Bus.Addressing.EIBAddress, type As EIB.BusData.EIBBusData_FrameACPI_L_Data_Type, value As Byte())
        _timeStamp = Now
        _isDublicate = isDublicate
        _message = message
        _busdata = busdata
        _sourceAddress = sourceAddress
        _destinationAddress = destinationAddress
        _type = type
        _value = value
        _valueString = EIB.Helper.HexConverters.ConvertByteArrayToHexString(value)

        'remove ValueString-Field for GroupAddressRead-Operation
        If type = EIB.BusData.EIBBusData_FrameACPI_L_Data_Type.Read Then _valueString = ""
    End Sub

    Private _sourceAddress As EIB.Bus.Addressing.EIBPhysicalAddress = Nothing
    Public ReadOnly Property SourceAddress As EIB.Bus.Addressing.EIBPhysicalAddress
        Get
            Return _sourceAddress
        End Get
    End Property

    Private _destinationAddress As EIB.Bus.Addressing.EIBAddress = Nothing
    Public ReadOnly Property DestinationAddress As EIB.Bus.Addressing.EIBAddress
        Get
            Return _destinationAddress
        End Get
    End Property

    Private _type As EIB.BusData.EIBBusData_FrameACPI_L_Data_Type
    Public ReadOnly Property Type As EIB.BusData.EIBBusData_FrameACPI_L_Data_Type
        Get
            Return _type
        End Get
    End Property

    Private _value As Byte()
    Public ReadOnly Property Value As Byte()
        Get
            Return _value
        End Get
    End Property

    Private _valueString As String
    Public ReadOnly Property ValueString As String
        Get
            Return _valueString
        End Get
    End Property
End Class
